home *** CD-ROM | disk | FTP | other *** search
- #include <iostream>
- #include <cmath>
- using namespace std;
-
- int main(int argc, char *argv[])
- {
- int retval = 0;
-
- try {
- if (argc<2)
- throw "Missing argument";
-
- double val = atof(argv[1]);
- if (val<=0)
- throw "Bad argument";
-
- cout << "The log of "
- << val
- << " is "
- << log(val)
- << endl;
- }
- catch (const char *msg) {
- cout << msg << endl;
- retval = 1;
- }
-
- return 0;
- }